function pretreat_images(image,row_subimage,column_subimage)

%pretreatment images

% clc,clear
% loadaddress='E:\�׳���\Rb87Files\Rb87spintexturedata\';  %address of files
% filename_pre='17639test_';      %expanded-name of files
% %files_if=[initialnumber finalnumber]
% files_if=[127 137];
% %if pictures includes 3 images,mode='3picture',else mode='1picture'
% mode='3picture';
% %define row and column number of subimage
% row_subimage=4;
% column_subimage=3;
% %load images from files
% [image]=drawpicture(loadaddress,filename_pre,files_if,mode);


%--------------------------------------------------------------------------
image_size=size(image);
residue=row_subimage*column_subimage-image_size(2);
% subimages=zeros(image_size(2),1);
% colorbar_range=[-0.2,0.1];

%define size of figure
figure('units','normalized','Name','Before Remove Background','position',[0.1,0.1,0.4,0.8]);
%ha = tight_subplot(row_subimage,column_subimage,[gap gap],[top bottom],[left right]);
 ha=tight_subplot(row_subimage,column_subimage,[.005 .005],[.2 .1],[.05 .05]);
 picture_note('title','Before Remove Background','xLabel','xpixels','yLabel','ypixels');
for im_numrow=1:row_subimage
    for im_numcolumn=1:column_subimage
        serial_number=im_numcolumn+(im_numrow-1)*column_subimage;
        if serial_number<=image_size(2)
               axes(ha(serial_number));
               imagesc(image(serial_number).data,[-0.2,0.1]);
               set(gca, 'XTick', [], 'YTick', []);
%                caxis(colorbar_range);
               axis tight;
           
           %add axes
           if im_numrow==1
               set(gca,'XtickMode', 'auto');
               set(gca,'XAxisLocation','top');
           end
           
           if im_numrow==row_subimage
               set(gca,'XtickMode', 'auto');
               set(gca,'XAxisLocation','bottom');
           end
           
           if im_numcolumn==1
                set(gca,'YtickMode', 'auto');
                set(gca,'YAxisLocation','left');
           end
           
           if im_numcolumn==column_subimage
               set(gca,'YtickMode', 'auto');
               set(gca,'YAxisLocation','right');
           end
           
           if residue~=0
               
              if (im_numcolumn>=column_subimage-residue+1)&(im_numrow==row_subimage-1)
                  if row_subimage==2
                     set(gca,'XtickMode', 'auto');
                     set(gca,'XAxisLocation','top');
                  else
                     set(gca,'XtickMode', 'auto');
                     set(gca,'XAxisLocation','bottom');
                  end
              end
              if (im_numcolumn==column_subimage-residue)&(im_numrow==row_subimage)
                  if column_subimage-residue>1
                     set(gca,'YtickMode', 'auto');
                     set(gca,'YAxisLocation','right');
                  end
              end
           end
        end  
        
    end
end

